package org.apache.maven.doxia.module.markdown;

import java.io.IOException;
import java.io.Writer;

import org.apache.maven.doxia.sink.AbstractTextSink;


public class MarkdownSink extends AbstractTextSink {
	
	private Writer writer;
	
	public MarkdownSink(final Writer writer) {
		this.writer = writer;
	}
	

	@Override
	public void rawText(final String s) {
		try {
	        writer.write(s);
        } catch (final IOException e) {
	        e.printStackTrace();
        }
	}
	
	@Override
	public void flush() {
		try {
			writer.write("</body></html>");
	        writer.flush();
        } catch (final IOException e) {
	        e.printStackTrace();
        }
	}
	
	@Override
	public void close() {
		try {
	        writer.close();
        } catch (final IOException e) {
	        e.printStackTrace();
        }
	}
	
}
